package com.pda.yuanjing.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.pda.yuanjing.database.InCode;
import com.pda.yuanjing.database.InStore;
import com.pda.yuanjing.database.OutCode;
import com.pda.yuanjing.database.OutStore;
import com.pda.yuanjing.database.RelationCode;
import com.pda.yuanjing.database.RelationRecord;

import com.pda.yuanjing.dao.InCodeDao;
import com.pda.yuanjing.dao.InStoreDao;
import com.pda.yuanjing.dao.OutCodeDao;
import com.pda.yuanjing.dao.OutStoreDao;
import com.pda.yuanjing.dao.RelationCodeDao;
import com.pda.yuanjing.dao.RelationRecordDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig inCodeDaoConfig;
    private final DaoConfig inStoreDaoConfig;
    private final DaoConfig outCodeDaoConfig;
    private final DaoConfig outStoreDaoConfig;
    private final DaoConfig relationCodeDaoConfig;
    private final DaoConfig relationRecordDaoConfig;

    private final InCodeDao inCodeDao;
    private final InStoreDao inStoreDao;
    private final OutCodeDao outCodeDao;
    private final OutStoreDao outStoreDao;
    private final RelationCodeDao relationCodeDao;
    private final RelationRecordDao relationRecordDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        inCodeDaoConfig = daoConfigMap.get(InCodeDao.class).clone();
        inCodeDaoConfig.initIdentityScope(type);

        inStoreDaoConfig = daoConfigMap.get(InStoreDao.class).clone();
        inStoreDaoConfig.initIdentityScope(type);

        outCodeDaoConfig = daoConfigMap.get(OutCodeDao.class).clone();
        outCodeDaoConfig.initIdentityScope(type);

        outStoreDaoConfig = daoConfigMap.get(OutStoreDao.class).clone();
        outStoreDaoConfig.initIdentityScope(type);

        relationCodeDaoConfig = daoConfigMap.get(RelationCodeDao.class).clone();
        relationCodeDaoConfig.initIdentityScope(type);

        relationRecordDaoConfig = daoConfigMap.get(RelationRecordDao.class).clone();
        relationRecordDaoConfig.initIdentityScope(type);

        inCodeDao = new InCodeDao(inCodeDaoConfig, this);
        inStoreDao = new InStoreDao(inStoreDaoConfig, this);
        outCodeDao = new OutCodeDao(outCodeDaoConfig, this);
        outStoreDao = new OutStoreDao(outStoreDaoConfig, this);
        relationCodeDao = new RelationCodeDao(relationCodeDaoConfig, this);
        relationRecordDao = new RelationRecordDao(relationRecordDaoConfig, this);

        registerDao(InCode.class, inCodeDao);
        registerDao(InStore.class, inStoreDao);
        registerDao(OutCode.class, outCodeDao);
        registerDao(OutStore.class, outStoreDao);
        registerDao(RelationCode.class, relationCodeDao);
        registerDao(RelationRecord.class, relationRecordDao);
    }
    
    public void clear() {
        inCodeDaoConfig.clearIdentityScope();
        inStoreDaoConfig.clearIdentityScope();
        outCodeDaoConfig.clearIdentityScope();
        outStoreDaoConfig.clearIdentityScope();
        relationCodeDaoConfig.clearIdentityScope();
        relationRecordDaoConfig.clearIdentityScope();
    }

    public InCodeDao getInCodeDao() {
        return inCodeDao;
    }

    public InStoreDao getInStoreDao() {
        return inStoreDao;
    }

    public OutCodeDao getOutCodeDao() {
        return outCodeDao;
    }

    public OutStoreDao getOutStoreDao() {
        return outStoreDao;
    }

    public RelationCodeDao getRelationCodeDao() {
        return relationCodeDao;
    }

    public RelationRecordDao getRelationRecordDao() {
        return relationRecordDao;
    }

}
